package org.seven.cpcrkapp.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public abstract class DateUtils {
    private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");

    public static Calendar getCalendar() {
        return Calendar.getInstance();
    }

    public static Date getDate() {
        return getCalendar().getTime();
    }

    public static int getYear() {
        return getCalendar().get(Calendar.YEAR);
    }

    public static int getMonth() {
        return getCalendar().get(Calendar.MONTH);
    }

    public static int getDay() {
        return getCalendar().get(Calendar.DAY_OF_MONTH);
    }

    public static String getString() {
        return simpleDateFormat.format(getDate());
    }

    public static String getString(int year, int month, int day) {
        Calendar calendar=getCalendar();
        calendar.set(Calendar.YEAR,year);
        calendar.set(Calendar.MONTH,month);
        calendar.set(Calendar.DAY_OF_MONTH,day);
        return simpleDateFormat.format(calendar.getTime());
    }
}